﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ecdl.demo.persistence;
using System.Xml.Serialization;

namespace ecdl.demo.model.expression {
    public abstract class ExpressionSerializer : DTODeserializer{
        public ExpressionSerializer() :base() {
        }

        protected override void RegisterTypes() {
            AddExpressionElementAttribute(typeof(AndDTO), "And");
            AddExpressionElementAttribute(typeof(OrDTO), "Or");
            AddExpressionElementAttribute(typeof(NotDTO), "Not");
        }

        protected override void AddOverrides() {
            AddAttributeOverride(typeof(SingleExpressionDTO), "Expression", GetExpressionXmlElementAttributes());
            AddAttributeOverride(typeof(NotDTO), "Expression", GetExpressionXmlElementAttributes());
            AddAttributeOverride(typeof(MultiExpressionDTO), "Expressions", GetExpressionXmlArrayAttributes());
        }
    }
}
